package main;

import java.text.DecimalFormat;
import java.text.NumberFormat;

//Nikolas Wolfe
//4/13/09
//CIS 4930
//Game of Life 2

/* =============================================================================
* Registers statistics for Worker Threads
*/

public class ThreadStatistics extends Statistics
{
	private NumberFormat formatter = new DecimalFormat("#0.00");
	
	public void registerThreadStartTime( long startTime )
	{
		setStartTime( startTime );
	}
	
	public void registerThreadStopTime( int threadId, long stopT )
	{
		setStopTime( stopT );
		String s = "Thread " + threadId + " completed its section in " 
			+ formatter.format(getElapsedTime()) + getUnits();
		append( s );
	}
	
	public void calculateAverageTime( int threadId )
	{
		String s = "Thread " + threadId + " Average Execution Time: " + 
		formatter.format(getAverageExecutionTime()) + getUnits();
		append( s );
	}
}
